// ie polyfill
import 'core-js/stable'
import 'regenerator-runtime/runtime'

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store/'
import Antd from 'ant-design-vue'

import Vant from 'vant'
import 'vant/lib/index.css'

import 'ant-design-vue/dist/antd.less'
import i18n from './locales'
import './assets/iconfont/iconfont.css'
import './components/global.less'
import { Dialog } from '@/components'
// import JSEncrypt from 'jsencrypt'
import 'lib-flexible'

Vue.config.productionTip = false
Vue.config.devtools = true

// mount axios Vue.$http and this.$http
Vue.use(Antd)
Vue.use(Vant)
Vue.use(Dialog)

new Vue({
  router,
  store,
  i18n,
  render: h => h(App)
}).$mount('#app')

// 防止重复点击
Vue.directive('preventReClick', {
  inserted (el, binding) {
    el.addEventListener('click', () => {
      if (!el.disabled) {
        el.disabled = true
        setTimeout(() => {
          el.disabled = false
        }, binding.value || 2000)
      }
    })
  }
})
